<template>
	<div class="tuiguang-box">
		<div class="tuiguang-con">
			<h3>欢迎加入我们</h3>
			<p>向朋友分享农淘优选优质的农特产品<br />您无需投入任何成本<br />即可成为农淘优选推广员<br />向朋友分享<br />成交后即可获得相应的佣金推广员</p>
		</div>
		<ul class="tuiguang-from" v-if="status==-1">
			<li><input type="text" v-model="contact" placeholder="请输入微信号/手机号"/></li>
			<li><input type="text" v-model="recommend" placeholder="请输入邀请码(选填)"/></li>
		</ul>
		<p class="tjshenhe" @click="tjshenhe()" v-if="status==-1">提交审核</p>
		<p class="zhanshi-btn" v-if="status===0">审核中</p>
		<p class="tjshenhe" v-if="status==1">申请成功</p>
		<p class="zhanshi-btn" v-if="status==2">平台拒绝</p>
		<navfot></navfot>
	</div>
</template>

<script>
	import navfot from '@/components/nav'
	export default{
		data () {
			return{
				user:0,
				contact:'',
				recommend:'',
				status:-1
			}
		},
		components:{navfot},
		created:function(){
			if(localStorage.getItem('nt_user')&&localStorage.getItem('nt_user')!=0){
				this.user=localStorage.getItem('nt_user');
			}else{
				this.$router.push({path:'/login'});
			}
		},
		methods:{
			tjshenhe:function(){
				var self=this;
				$.ajax({
					type:"post",
					url:furl+"index.php?app=ajax_buyer_order&act=member_dst",
					data:{'token':self.user,'contact':self.contact,'recommend':self.recommend},
					dataType:'json',
					success:function(res){
						if(res.done){
							self.status=0;
						}
					}
				});
			}
		},
		mounted:function(){
			var self=this;
			$.ajax({
				type:"get",
				url:furl+"index.php?app=ajax_buyer_order&act=member_dst",
				data:{'token':self.user},
				dataType:'json',
				success:function(res){
					if(res.done){
						if(res.retval.length==0){
							self.status=-1;
						}else{
							self.status=res.retval.status;
						}
					}
				}
			});
		}
	}
</script>

<style>
	.tuiguang-box{font-size:0;text-align: center;height:100%;background-color:#fff;padding-bottom:1.3rem;overflow-y: scroll;box-sizing: border-box;}
	.tuiguang-con>h3{font-size:0.48rem;color:#4C9D31;padding-top: 1.47rem;padding-bottom: 0.7rem;line-height: 0.48rem;}
	.tuiguang-con>p{font-size:0.32rem;color:#666;line-height: 0.56rem;}
	.tjshenhe{width:5.47rem;height:0.9rem;border-radius:0.45rem;background-color:#4C9D31;text-align: center;line-height: 0.9rem;box-sizing: border-box;color:#fff;font-size:0.32rem;margin:0 auto;margin-top: 0.52rem;}
	.tuiguang-from{width:5.47rem;margin:0 auto;}
	.tuiguang-from li{width:5.47rem;height:0.9rem;border:1px solid #4C9D31;border-radius:0.45rem;overflow: hidden;margin-top: 0.52rem;}
	.tuiguang-from li>input{width:80%;height:100%;text-align: center;font-size:0.32rem;color:#2B2B2B;}
	.zhanshi-btn{width:5.47rem;height:0.9rem;border-radius:0.45rem;background-color:#8DB87E;text-align: center;line-height: 0.9rem;box-sizing: border-box;color:#D9FFCC;font-size:0.32rem;margin:0 auto;margin-top: 0.52rem;}
</style>